<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>班次管理</title>
    <meta name="decorator" content="nblank"/>
    <link href="${ctxStatic}/modules/biz/monitorCenter/handover.css" rel="stylesheet">
</head>
<body>
<div class="content container">
    <h2 class="page-title">班次管理
        <small> 班次查看</small>
    </h2>
    <section class="widget widget-tabs widget-table-overflow ">
        <header>
            <ul class="nav nav-tabs">
                <li class="active"><a href="javascript:;">班次查看</a></li>
                <shiro:hasPermission name="sys:dict:edit">
                    <li><a href="${ctx}/biz/handover/form">班次修改</a></li>
                </shiro:hasPermission>
            </ul>
        </header>
        <div class="body tab-content">
            <sys:message content="${message}"/>
            <div class="form-inline text-align-right padding-2-10 padding-bottom-50">
                <div class="form-group no-margin col-md-5">
                    <label class="control-label col-md-5"><font color="red"></font>最少人数:</label>
                    <div class="col-md-2">
                        <input id="leastPeople" readonly="" class="form-control input-transparent" value="${handover.leastPeople}">
                    </div>
                </div>
                <div class="form-group no-margin col-md-4">
                    <label class="control-label col-md-4"><font color="red"></font>缓冲时间:</label>
                    <div class="input-group  col-md-8">
                        <input path="leastPeople" readonly="" class="form-control input-transparent" value="${handover.bufferTime}">
                        <div class="input-group-addon">分钟</div>
                    </div>
                </div>
                <div class="col-md-3 form-group no-margin" style="height:30px;">
                    <input type="checkbox" name="hvswitch" data-on-text="开启" data-off-text="关闭"
                           <c:if test="${handover.isActive == '1'}">checked </c:if>>
                </div>
            </div>
            <fieldset class="mt-sm no-margin">
                <legend>班次及时间</legend>
            </fieldset>
            <div class="form-inline text-align-right col-top padding-0-10">
                <div class="row">
                    <div class="form-group no-margin col-md-5">
                        <label class="control-label col-md-5"><font color="red"></font>班别名称:</label>
                        <div class="col-md-2">
                            <input readonly="" class="form-control input-transparent" value="${handover.name1}">
                        </div>
                    </div>
                    <div class="form-group no-margin col-md-7 padding-left-26">
                        <label class="control-label col-md-2"><font color="red"></font>起止时间:</label>
                        <div class="col-sm-8 col-md-8 form-inline">
                            <div class="row text-align-left">
                                <div class="input-group col-sm-5">
                                    <fmt:formatDate var="stime1_fmt" value="${handover.stime1}" pattern="HH:mm"/>
                                    <input readonly class="form-control input-transparent" value="${stime1_fmt}"/>
                                </div>
                                <span>-</span>
                                <div class="input-group col-sm-5">
                                    <fmt:formatDate var="etime1_fmt" value="${handover.etime1}" pattern="HH:mm"/>
                                    <input readonly class="form-control input-transparent" value="${etime1_fmt}"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <c:if test="${!empty handover.name2}">
                <div class="form-inline text-align-right margin-top-25 padding-0-10">
                    <div class="row">
                        <div class="form-group no-margin col-md-5">
                            <label class="control-label col-md-5"><font color="red"></font>班别名称:</label>
                            <div class="col-md-2">
                                <input readonly="" class="form-control input-transparent" value="${handover.name2}">
                            </div>
                        </div>
                        <div class="form-group no-margin col-md-7 padding-left-26">
                            <label class="control-label col-md-2"><font color="red"></font>起止时间:</label>
                            <div class="col-sm-8 col-md-8 form-inline">
                                <div class="row text-align-left">
                                    <div class="input-group col-sm-5">
                                        <fmt:formatDate var="stime2_fmt" value="${handover.stime2}" pattern="HH:mm"/>
                                        <input readonly class="form-control input-transparent" value="${stime2_fmt}"/>
                                    </div>
                                    <span>-</span>
                                    <div class="input-group col-sm-5">
                                        <fmt:formatDate var="etime2_fmt" value="${handover.etime2}" pattern="HH:mm"/>
                                        <input readonly class="form-control input-transparent" value="${etime2_fmt}"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </c:if>
            <c:if test="${!empty handover.name3}">
                <div class="form-inline text-align-right margin-top-25 padding-0-10">
                    <div class="row">
                        <div class="form-group no-margin col-md-5">
                            <label class="control-label col-md-5"><font color="red"></font>班别名称:</label>
                            <div class="col-md-2">
                                <input readonly="" class="form-control input-transparent" value="${handover.name3}">
                            </div>
                        </div>
                        <div class="form-group no-margin col-md-7 padding-left-26">
                            <label class="control-label col-md-2"><font color="red"></font>起止时间:</label>
                            <div class="col-sm-8 col-md-8 form-inline">
                                <div class="row text-align-left">
                                    <div class="input-group col-sm-5">
                                        <fmt:formatDate var="stime3_fmt" value="${handover.stime3}" pattern="HH:mm"/>
                                        <input readonly class="form-control input-transparent" value="${stime3_fmt}"/>
                                    </div>
                                    <span>-</span>
                                    <div class="input-group col-sm-5">
                                        <fmt:formatDate var="etime3_fmt" value="${handover.etime3}" pattern="HH:mm"/>
                                        <input readonly class="form-control input-transparent" value="${etime3_fmt}"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </c:if>
        </div>
    </section>
</div>
<script src="${ctxStatic}/bootstrap-switch/js/bootstrap-switch.min.js" itself="true"></script>
<script>
    $(function () {
        var $colum = $("[name='hvswitch']");
        $colum.bootstrapSwitch({
            size: "small",
            onSwitchChange: function (event, state) {
                var vr = false;
                bootbox.confirm(state ? "确认要执行开启操作吗?" : "确认要执行关闭操作吗?", function (result) {
                    if (result) {
                        onAjaxSwitch($colum, "${ctx}/biz/handover/switch", state);
                    } else {
                        $colum.trigger("previousState.bootstrapSwitch", true);
                    }
                });
            }
        });
    });

    function onAjaxSwitch($ele, url, state) {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: url,
            data: "state=" + state,
            success: function (msg) {
                if (msg == "1") {
                    Messenger().post("操作成功!");
                } else {
                    $colum.trigger("previousState.bootstrapSwitch", true);
                    Messenger().post("操作失败!");
                }
            }
        })
    }
</script>
</body>
</html>